package dimensional.traveler.server.model;

import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import dimensional.traveler.shared.model.Mission;
import dimensional.traveler.shared.model.Shop;
import dimensional.traveler.shared.model.Trainer;
import dimensional.traveler.shared.model.missionSequence.MissionEndDetails;

public class Career implements Serializable {

	private static final long serialVersionUID = 82813362221530855L;

	private static Long counter = 0l;

	private Long id;

	private int numberOfCompletedMissions = 0;
	private List<Mission> newMissions = new LinkedList<>();
	private List<Mission> oldMissions = new LinkedList<>();

	private List<Shop> shops = new LinkedList<>();
	private List<Trainer> trainers = new LinkedList<>();

	private Mission activeMission;

	public Career(CharacterClass characterClass) {
		id = counter++;

		// TODO transform character class... add companions... add inventory...
	}

	public Career() {
		// TODO Auto-generated constructor stub
	}

	public Long getId() {
		return id;
	}

	public int getNumberOfCompletedMissions() {
		return numberOfCompletedMissions;
	}

	public void initMissions(Mission tutorial) {
		newMissions.add(tutorial);
	}

	public List<Mission> getNewMissions() {
		return newMissions;
	}

	public List<Mission> getOldMissions() {
		return oldMissions;
	}

	public MissionEndDetails completeMission(Mission mission) {
		trainers.addAll(mission.getNewlyAvailableTrainers());
		shops.addAll(mission.getNewlyAvailableShops());
		MissionEndDetails details = new MissionEndDetails();
		details.victorious = true;
		details.enemiesKilled = 3;
		return details;
	}

	public void setActiveMission(Mission mission) {
		this.activeMission = mission;
	}

	public Mission getActiveMission() {
		return activeMission;
	}

	public void resetUserCharacter(String characterClassId) {
		// TODO Auto-generated method stub
		
	}

}
